from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())

from openai import OpenAI
client = OpenAI()
# from zhipuai import ZhipuAI
# client = ZhipuAI()

def get_completion(prompt, model="deepseek-chat", temperature=0.01):
    messages = [{"role": "user", "content": prompt}]
    response = client.chat.completions.create(
        model=model,
        messages=messages,
        temperature=temperature  
    )
    return response.choices[0].message.content
  
while True:  
    user_input = input("请输入提示文字（输入'exit'退出程序）: ")  
    if user_input is None or user_input == "" :
        continue
    elif user_input.lower() == 'exit':  
        print("程序退出。")  
        break  
    else :
        res = get_completion(user_input, temperature=0.7)  
        print("\n===大语言模型completion：===") 
        print(res)
        print("============END============")  